// cons_test.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <stdlib.h>
#include <Windows.h>

#define WIDTH	20
#define HEIGHT	40

HWND hwnd;
HANDLE hStdOut;
HANDLE hOutBuf;


void show() {
	DWORD readWriteLen = 0;
	char *letter = "abcdefghijklmnopqrstuvwxyz";
	int index = 0;
	while (true)
	{
		SetConsoleCursorPosition(hStdOut, { 0, 0 });
		for (int i = 0; i < WIDTH; i++) {
			for (int j = 0; j < HEIGHT; j++) {

				if ((i > WIDTH / 3) && (i < WIDTH / 3 * 2) && (j > HEIGHT / 3) && (j < HEIGHT / 3 * 2)) {
					WriteConsoleA(hStdOut, " ", 1, &readWriteLen, NULL);
					continue;
				}
				WriteConsoleA(hStdOut, &letter[index], 1, &readWriteLen, NULL);
			}
			WriteConsoleA(hStdOut, "\n", 1, &readWriteLen, NULL);
		}
		Sleep(500);
		index++;
		index = index % 20;
	}
}

int main(){
	HWND hwnd = GetConsoleWindow();
	hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);

	CONSOLE_CURSOR_INFO cci = { 0 };
	SetConsoleCursorInfo(hStdOut, &cci);


	SetWindowPos(hwnd, HWND_TOP, 0, 0, 400, 400, SWP_NOMOVE| SWP_NOZORDER);
	show();

	getchar();
    return 0;
}